package com.wnhz.work.yz.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.wnhz.work.yz.BaseActivity;
import com.wnhz.work.yz.MyApplication;
import com.wnhz.work.yz.R;
import com.wnhz.work.yz.base.BaseRVAdapter;
import com.wnhz.work.yz.base.BaseViewHolder;

public class YanShouZGLBActivity extends BaseActivity implements View.OnClickListener {
    private RecyclerView recycler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_yan_shou_zglb);
        TextView title = (TextView) findViewById(R.id.view_main_middle_title);
        title.setText("整改产品列表");
        findViewById(R.id.btn_main_left).setOnClickListener(this);
        TextView submit = (TextView) findViewById(R.id.submit);
        submit.setText("验收提交");
        submit.setTextSize(12);
        submit.setVisibility(View.VISIBLE);
        submit.setOnClickListener(this);


        recycler = (RecyclerView) findViewById(R.id.recycler);
        recycler.setLayoutManager(new GridLayoutManager(this, 2, LinearLayoutManager.VERTICAL, false));
        recycler.setAdapter(new BaseRVAdapter(this, MyApplication.test) {
            @Override
            public int getLayoutId(int viewType) {
                return R.layout.item_chanpin;
            }

            @Override
            public void onBind(BaseViewHolder holder, int position) {
                holder.getView(R.id.ll_max).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        startActivity(new Intent(YanShouZGLBActivity.this, YanShouErCiActivity.class));
                    }
                });

            }

        });
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_main_left:
                finish();
                break;
            case R.id.submit:
                startActivity(new Intent(this, ChuFaDanActivity.class));
                break;
        }
    }
}
